import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import {resolve} from 'path';
import copy from 'rollup-plugin-copy' //引入插件
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(), 
    vueJsx(),
    copy({
      targets: [
        { src: './packages/assets/geo/*', dest: 'lib/geo' }, //执行拷贝
      ]
    })
  ],
  resolve: {
    alias: [
      {find: '@', replacement: resolve(__dirname, './examples')},
      {find: '$comp', replacement: resolve(__dirname, './packages')}
    ]
  },
  build: {
    outDir: 'lib/core',
    lib: {
      entry: resolve(__dirname, 'packages/index.js'), // 指定组件编译入口文件
      name: 'dvHub',
      fileName: 'dv-hub'
    },
    assetsDir: 'geo',
    rollupOptions: {
      external: ['vue'],
      output: {
        globals: {
          vue: 'Vue'
        }
      }
    }
  }
})
